<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="view-port" content="width=device-width,initial-scale=1.0,maxminum-scale=1.0,user-scalable=">

    <title>love</title>
    <link href="favicon.ico" rel="shortcut icon" />
    <style>
        .wrap {
            width: 0;
            height: 0;
            margin: 100px auto;
            position: relative;
            border-bottom: 70px solid #dc5947;
            border-left: 100px solid transparent;
            border-right: 100px solid transparent;
            transform: rotate(35deg);
        }
        
        .wrap::after {
            content: "";
            width: 0;
            height: 0;
            border-bottom: 70px solid #dc5947;
            border-left: 100px solid transparent;
            border-right: 100px solid transparent;
            transform: rotate(-70deg);
            position: absolute;
            top: 0px;
            left: -100px;
        }
        
        .wrap::before {
            content: "";
            width: 0;
            height: 0;
            border-bottom: 80px solid #dc5947;
            border-left: 30px solid transparent;
            border-right: 30px solid transparent;
            transform: rotate(-35deg);
            position: absolute;
            top: -45px;
            left: -60px;
        }
    </style>

</head>

<body>

    <div class="wrap">
    </div>
</body>
<script type="text/javascript">
    let n = 4;
    let m = 2;
    let no_arr = [2, 1];

    function func(n, arr) {
        let initial_states = new Array(n).fill(-1); // 初始化所有电灯的状态数组
        let count = 1; // 关灯的次序
        for (let i = 0; i < arr.length; i++) { // 遍历按下的开关数组
            let index = arr[i] - 1; // 取得当前开关编号对应的状态数组下标
            while (initial_states[index] === -1 && index < initial_states.length) {
                initial_states[index] = count;
                index++;
            }
            count += 1;
        }
        return initial_states;
    }
    console.log(func(n, no_arr))
</script>

</html>